package com.baidumap.administrator.happystudy.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;

import com.baidumap.administrator.happystudy.R;
import com.baidumap.administrator.happystudy.ui.SupermarketHomeActivity;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@SuppressWarnings("all")
public class RestauranFind1Adapter extends BaseAdapter {
	private List<Map<String, Object>> lists;
	private Context context;
	private ViewHolder holder;
	private LayoutInflater inflater;
	private ImageLoader loader;
	private DisplayImageOptions options;
	public ArrayList<A> list;

	public RestauranFind1Adapter(Context _Context, ImageLoader loader) {

		this.context = _Context;
		this.loader = loader;

	}

	public void bindData(List<Map<String, Object>> list) {
		this.lists = list;
	}


	class ViewHolder {
		private LinearLayout list_lay;
	}

	@Override
	public int getCount() {
		return lists.size();
	}

	@Override
	public List<Map<String, Object>> getItem(int position) {
		return (List<Map<String, Object>>) lists.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@SuppressLint("NewApi")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = convertView;
		final int index = position;
		if (convertView != null) {

			holder = (ViewHolder) view.getTag();

		} else {
			convertView = LayoutInflater.from(context).inflate(
					R.layout.item_restauran, null);
			holder = new ViewHolder();

			holder.list_lay = (LinearLayout) convertView.findViewById(R.id.list_lay);

			convertView.setTag(holder);
		}
		holder.list_lay.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent it = new Intent(context,SupermarketHomeActivity.class);
				context.startActivity(it);
			}
		});


		return convertView;
	}

	public class A {

		public static final int TYPE_CHECKED = 1;
		public static final int TYPE_NOCHECKED = 0;

		public boolean type;
		public String phone;
		public A(boolean type,String phone) {
			this.type = type;
			this.phone = phone;
		}
	}

}
